package org.mili.ticketeer.ui.ticket;

import org.mili.ticketeer.dto.Ticket;
import org.mili.application.service.ServiceException;
import org.mili.application.service.ServiceFactory;
import org.mili.ticketeer.service.TicketService;
import org.mili.application.ui.Form;
import org.mili.application.ui.SearchPanel;

/**
 * Created with IntelliJ IDEA.
 * User: papa
 * Date: 20.07.13
 * Time: 14:10
 * To change this template use File | Settings | File Templates.
 */
public class TicketSearchPanel extends SearchPanel<Ticket> {
    private static TicketService ticketService = ServiceFactory.getService(TicketService.class);

    public TicketSearchPanel() {
        super(new TicketTableModel());
    }

    @Override
    public void formChanged(Form form) {
        getTableModel().update();
    }

    @Override
    public Ticket create() {
        return new Ticket();
    }

    @Override
    public void delete(Ticket element) throws ServiceException {
        ticketService.delete(element);
    }
}
